package stringtest01;

public class SplitUrl {
    public static void main(String[] args) {
        String url = "http://localhost:8088/myweb/reg?name=zhangsan&pwd=123456&nick=san&age=16";
        String[] arr=url.split("\\?");
        System.out.println("请求："+arr[0]);
        System.out.println("参数："+arr[1]);
        //
        //拆分按照&
        arr=arr[1].split("&");
        for (int i = 0; i < arr.length; i++){
            String line=arr[i];
            //拆分按照=
            String[] arr2=line.split("=");
            System.out.println("参数名："+arr2[0]+", 参数值："+arr2[1]);
        }

    }
}
